Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer API changes for handling dict() #202

Merged

Conversation

Jeyaprakash-NK
Copy link
Collaborator

@Jeyaprakash-NK Jeyaprakash-NK commented Dec 17, 2024

Added Content-Type header will be set to 'application/json' for composer list environments.

@Jeyaprakash-NK Jeyaprakash-NK changed the title Composer API changes for handling dict() Do not merge - Composer API changes for handling dict() Dec 18, 2024
@Jeyaprakash-NK Jeyaprakash-NK changed the title Do not merge - Composer API changes for handling dict() Composer API changes for handling dict() Dec 18, 2024
Comment on lines 35 to 38
if isinstance(environments, list):
self.finish(json.dumps(environments, default=lambda x: x.dict()))
else:
self.finish(environments)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not correct, we should continue to use the json.dumps method to ensure the written output is JSON.

What is the effect you are trying to achieve here?

The only practical difference between this and what we have now is that if the environments value is a dictionary, then the Content-Type header will be set to application/json.

Is that what you are trying to do? If so, then we should set that header regardless of the type of environments.

I.E. merely call self.set_header("Content-Type", "application/json") prior to calling self.finish(...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Content-Type header will be set to 'application/json' for composer list environments.

@ojarjur ojarjur merged commit dfe1dd4 into GoogleCloudDataproc:main Dec 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants